<?php 
$demot = View::get('demot'); 
$demots_categories = View::get('demots_categories');

?>
<div class="round left half">
    <div class="round-head">
    <h2>Edytuj demotywator (<?php echo $demot['id'] ?>)</h2>
    </div>
    
    <div class="round-content">

    <div class="error icon"><img class="demot-image" src="./bank/demot/mini/<?php echo $demot['id'] ?>.jpg"/></div></div>

    <form action="index.php?controller=demot&action=update" method="POST" class="uniForm"> 
            <fieldset class="inlineLabels">
                    <input type="hidden" name="data[id]" value="<?php echo $demot['id']; ?>" />
                    <div class="ctrlHolder"> 
                            <label for="name3">Tytuł</label> 
                            <input type="text" id="name3" name="data[title]" value="<? echo $demot['title']; ?>" size="35" class="textInput"/> 
                    </div> 

                    <div class="ctrlHolder"> 
                            <label for="email3">Obrazek</label> 
                            <input type="text" id="email3" name="data[img]" value="<? echo $demot['img']; ?>" size="35" class="textInput"/>                            
                    </div> 
                
                    <div class="ctrlHolder"> 
                            <label for="email3">Kategoria</label> 
                            <select name="data[id_category]">
                                <?php foreach ($demots_categories as $d): ?>
                                <option <?php if ($d['id']==$demot['id_category']) echo "selected"; ?> value="<?php echo $d['id'] ?>" ><?php echo $d['name']; ?></option>
                                <?php endforeach; ?>
                             </select>                            
                    </div> 
                    
                    <div class="ctrlHolder"> 
                            <label for="email3">YoutTube Link</label> 
                            <input type="text" id="email3" name="data[movie]" value="<? echo $demot['movie']; ?>" size="35" class="textInput"/>                             
                    </div> 
                    
                    <div class="ctrlHolder"> 
                            <label for="email3">Status</label> 
                            <select name="data[id_statuses]">
                                <?php foreach (DStatus::getArray() as $k => $v): ?>
                                <option <?php if ($k==$demot['id_statuses']) echo "selected"; ?> value="<?php echo $k ?>" ><?php echo $v; ?></option>
                                <?php endforeach; ?>
                             </select>                            
                    </div> 
                    
                    <div class="ctrlHolder"> 
                            <label for="email3">Typ</label> 
                            <select name="data[id_type]">
                                <?php foreach (DStatus::getTypeArray() as $k => $v): ?>
                                <option <?php if ($k==$demot['id_type']) echo "selected"; ?> value="<?php echo $k ?>" ><?php echo $v ?></option>
                                <?php endforeach; ?>
                            </select>                            
                    </div> 
                    <div class="ctrlHolder" >  
                            <label>Treści dla dorosłych (+18)</label> 
                            <input type="checkbox" id="name3" name="data[for_adults]" <?php if (intval($demot['for_adults']) == 1) echo "checked"; ?> class="textInput"  style="width: auto;"/>                                                   
                    </div> 

                    <div class="ctrlHolder" >  
                            <label>Pozostałe</label> 
                            <input type="checkbox" id="name3" name="data[is_active]" <?php if (intval($demot['is_active']) == 1) echo "checked"; ?> class="textInput"  style="width: auto;"/>Aktywny                                                       
                    </div> 

                    <div class="buttonHolder">  
                            <button type="submit" class="primaryAction">Uaktualnij</button> 
                    </div> 
            </fieldset> 
    </form> 

    </div>

</div>